﻿using PEMath;
/****************************************************
// 功能：单体移速buff
// | Talk To [ 聊来改善地区金融服务环境，助力企业发展 ]
// | Copyright (c) 2021-2025 聊来 All rights reserved.
// | Licensed ( <a href="http://www.apache.org/licenses/LICENSE-2.0">聊来</a> )
// | @Author: 贯彻己道的云 <18970881148@qq.com>
// | DateTime: 2025/4/9 10:09:12
*****************************************************/
public class MoveSpeedBuffCfg : BuffCfg {
    public int amount;//速度改变量，百分比
}

public class MoveSpeedBuff_Single : Buff {
    private PEInt speedOffset;

    public MoveSpeedBuff_Single(MainLogicUnit source, MainLogicUnit owner, Skill skill, int buffID, object[] args = null)
        : base(source, owner, skill, buffID, args) {
    }

    public override void LogicInit() {
        base.LogicInit();

        var move = cfg as MoveSpeedBuffCfg;
        speedOffset = owner.moveSpeedBase * ((PEInt) move!.amount / 100);
    }

    protected override void Start() {
        base.Start();
        owner.ModifyMoveSpeed(speedOffset, this, true);
    }

    protected override void End() {
        base.End();
        owner.ModifyMoveSpeed(-speedOffset, this, false);
    }
}
